#ifndef SERVERWIDGET_H
#define SERVERWIDGET_H

#include <QWidget>
#include<QTcpServer>
#include<QTcpSocket>
#include<QFile>
#include<QFileDialog>
#include<QFileInfo>
#include<QTimer>
namespace Ui {
class ServerWidget;
}

class ServerWidget : public QWidget
{
    Q_OBJECT

public:
    explicit ServerWidget(QWidget *parent = nullptr);
    ~ServerWidget();

    void sendData();//发送文件数据

private slots:
    void on_buttonFile_clicked();

    void on_buttonSend_clicked();

private:
    Ui::ServerWidget *ui;

    QTcpServer *tcpserver;
    QTcpSocket *tcpsocket;

    QFile file;
    QString fileName;
    qint64 fileSize;
    qint64 sendSize;//已经发送文件的大小

    QTimer timer;
};

#endif // SERVERWIDGET_H
